package com.itheima.test;

import java.util.Scanner;

/**
 * @Author 王加鑫
 * @Date 2021/4/19 19:34
 * @Version 1.0
 * 5、【编号：601】 通过键盘录入的方式输入星期数(1-7的整数)，显示今天的减肥活动，使用switch和if两种判断语句分别完成。
 * ​            周一：跑步
 * ​            周二：游泳
 * ​            周三：慢走
 * ​            周四：动感单车
 * ​            周五：拳击
 * ​            周六：爬山
 * ​            周日：好好吃一顿
 */
public class Day03_HomeWork05 {
    public static void main(String[] args) {
        Day03_HomeWork05 homeWork05 = new Day03_HomeWork05();
//        homeWork05.switchTest();
        homeWork05.ifTest();

    }

    /*
    使用switch
     */
    public void switchTest(){
        Scanner sc = new Scanner(System.in);
        lo:while (true){
            System.out.println("请输入星期数:");
            int week = sc.nextInt();
            if(week>=0 && week<=7){
                switch (week){
                    case 0:
                        System.out.println("感谢您的使用");
                        break lo;
                    case 1:
                        System.out.println("跑步");
                        break;
                    case 2:
                        System.out.println("游泳");
                        break;
                    case 3:
                        System.out.println("慢走");
                        break;
                    case 4:
                        System.out.println("动感单车");
                        break;
                    case 5:
                        System.out.println("拳击");
                        break;
                    case 6:
                        System.out.println("爬山");
                        break;
                    case 7:
                        System.out.println("好好吃一顿");
                        break;
                }
            }else {
                System.out.println("您输入有误");
            }
        }
    }

    /*
    使用if
     */
    public void ifTest(){
        Scanner sc = new Scanner(System.in);
        while (true){
            System.out.println("请输入星期数:");
            int week = sc.nextInt();
            if(week >= 0 && week <= 7){
                if(week == 0){
                    System.out.println("感谢您的使用");
                    break;
                }else if(week == 1){
                    System.out.println("跑步");
                }else if(week == 2){
                    System.out.println("游泳");
                }else if(week == 3){
                    System.out.println("慢走");
                }else if(week == 4){
                    System.out.println("动感单车");
                }else if(week == 5){
                    System.out.println("拳击");
                }else if(week == 6){
                    System.out.println("爬山");
                }else if(week == 7){
                    System.out.println("好好吃一顿");
                }
            }else {
                System.out.println("您输入有误");
            }
        }


    }
}
